using CR.Domain.Entities;
using CR.ErrorCode;
using System.Threading.Tasks;

namespace CR.API.Services
{
    /// <summary>
    /// 用户服务接口
    /// </summary>
    public interface IUserService
    {
        /// <summary>
        /// 用户登录
        /// </summary>
        /// <param name="username">用户名</param>
        /// <param name="password">密码</param>
        /// <param name="captchaId">验证码ID</param>
        /// <param name="captchaCode">验证码</param>
        /// <returns>登录结果</returns>
        Task<ApiResult<string>> LoginAsync(string username, string password, string captchaId, string captchaCode);
        
        /// <summary>
        /// 注册用户
        /// </summary>
        /// <param name="user">用户信息</param>
        /// <param name="password">密码</param>
        /// <returns>注册结果</returns>
        Task<ApiResult<User>> RegisterAsync(User user, string password);
        
        /// <summary>
        /// 获取用户信息
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <returns>用户信息</returns>
        Task<ApiResult<User>> GetUserAsync(int userId);
        
        /// <summary>
        /// 修改密码
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <param name="oldPassword">旧密码</param>
        /// <param name="newPassword">新密码</param>
        /// <returns>修改结果</returns>
        Task<ApiResult> ChangePasswordAsync(int userId, string oldPassword, string newPassword);
        
        /// <summary>
        /// 解锁用户
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <returns>解锁结果</returns>
        Task<ApiResult> UnlockUserAsync(int userId);
        
        /// <summary>
        /// 获取当前用户
        /// </summary>
        /// <returns>当前用户，如果未登录则返回null</returns>
        Task<User?> GetCurrentUserAsync();
    }
} 